/********************************************************************
 * File: main.c
 * Description: UART transceiver testing program.
 * Version: v0.0
 * Date: 2024-5-21
 * Author: zhengxinyu13@qq.com
 * ---------- Revision History ----------
 * <version> <date> <author> <desc>
 * 
 ********************************************************************/

#include "main.h"

/* User Code Includes */
#include "uart.h"
#include <stdio.h>

/* User Code Define */
#define MESSAGE "Grayson Zheng\r\n"

/* User Code Global Variables */

/* User Code Function prototypes */


/* ------------------------------ Division Line ------------------------------ */

/**
 * @brief Initialize all configured.
 */
void setup(void)
{
    /* put your setup code here, to run once: */
    uart_init(BAUD_RATE_9600, UART_IRP_ENABLE, NONE_PARITY);
    delay_ms(500);
    printf(MESSAGE);
}

/**
 * @brief The application entry point.
 */
void main(void)
{
    /* Private variables */
    
    /* Initialize */
    setup();
	/* Infinite loop */
    while (TRUE) {
        /* put your main code here, to run repeatedly: */
        if (uart_rec.flag) {
            printf("Get: %s", uart_rec.buff);
            uart_rec.flag = TURN_OFF;
        }
    }
}
